#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct Student {
	char name[10]; // 名字
	char number[20]; // 学号
	int C;
	int MC; // C最高
	int English;
	int MEnglish; // 英语最高
	int Math;
	int MMath; // 数学最高
	float average; // 平均分
	int totality; // 成绩总和
	int maxgrade; // 历史最高分
	int daily; // 平时
} Student;

int main() {
	FILE* pf = fopen("成绩2.0.txt", "r");
	if (pf == NULL) {
		perror("文件打开失败");
		return -1;
	}
	
	Student students[50];
	int i = 0;
	while (fscanf(pf, "%9s %s %d %d %d %d %d %d %f %d %d %d",
		students[i].name,
		students[i].number,
		&students[i].C,
		&students[i].MC,
		&students[i].English,
		&students[i].MEnglish,
		&students[i].Math,
		&students[i].MMath,
		&students[i].average,
		&students[i].totality,
		&students[i].maxgrade,
		&students[i].daily) != EOF) {
		i++;
	}
	
	fclose(pf);
	
	// 输出读取到的学生数据
	for (int j = 0; j < i; j++) {
		printf("%s %s %d %d %d %d %d %d %.2f %d %d %d\n",
			students[j].name,
			students[j].number,
			students[j].C,
			students[j].MC,
			students[j].English,
			students[j].MEnglish,
			students[j].Math,
			students[j].MMath,
			students[j].average,
			students[j].totality,
			students[j].maxgrade,
			students[j].daily);
	}
	
	return 0;
}
